package com.cyt.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.cyt.dao.impl.XingWenFengLeiDaoImpl;
import com.cyt.dao.impl.XingWengXiZhiDaoImpl;
import com.cyt.dao.impl.XingWengXiZhiTwoDaoImpl;
import com.cyt.entity.ShangPingXX;
import com.cyt.entity.XingWenFengLei;
import com.cyt.entity.XingWengXiZhi;

//  新闻分类  新闻详细内容
public class NewsDetallServlet extends HttpServlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		XingWenFengLeiDaoImpl xDao= new XingWenFengLeiDaoImpl();//创建对象
	    List <XingWenFengLei> list=xDao.getXingWenFengLei();//调用方法获得用户集合
	   request.setAttribute("xw", list);//将数据存入request中
	   
	 
	   int xWid =Integer.parseInt(request.getParameter("categoryId"));
	   XingWengXiZhiTwoDaoImpl xWXDao=new XingWengXiZhiTwoDaoImpl();
	   List <XingWengXiZhi> xWTwoList =  xWXDao.getXingWengXiZhiTwo(xWid);
	   request.setAttribute("XingWengXiZhiTwoList", xWTwoList);//将数据存入request中
	   
	   int did =Integer.parseInt(request.getParameter("categoryId"));
	   XingWengXiZhiDaoImpl shangDao=new XingWengXiZhiDaoImpl();
	   List <XingWengXiZhi> shanDao =  shangDao.getXingWengShang(did);
	   request.setAttribute("ShangYT", shanDao);//将数据存入request中
	   
	   int didX =Integer.parseInt(request.getParameter("categoryId"));
	   XingWengXiZhiDaoImpl XiaDao=new XingWengXiZhiDaoImpl();
	   List <XingWengXiZhi> xiaYDao =  XiaDao.getXingWengXia(didX);
	   request.setAttribute("XiaYT", xiaYDao);//将数据存入request中
	   
	 request.getRequestDispatcher("article_list_content.jsp").forward(request, response);
	
	  
	  
	
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}
}
